<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="product" tagdir="/WEB-INF/tags/product"%>
<%@ taglib prefix="order" tagdir="/WEB-INF/tags/order"%>
<%@ taglib prefix="system" tagdir="/WEB-INF/tags/system"%>


<div class="content">
	<div class="box_04">
		<div class="cnt">
			<div class="top">
				<fmt:message key="salesOrder.addPanel.payAndShipMethod" />
			</div>
			<c:choose>
				<c:when test="${not empty regionId}">
					<table width="100%" border="0" cellspacing="0" cellpadding="0" class="settings_table1"  height="60px;">
						<tr >
							<th width="120px;"><fmt:message key="checkout.paymentMethod.paymentMethodName"/>(<span class="red">*</span>)：</th>
							<td>
								<c:forEach items="${paymentMethodList}" var="paymentMethod">
									<label for="paymentMethodId_${paymentMethod.paymentMethodId}">
										<input type="radio" id="paymentMethodId_${paymentMethod.paymentMethodId}" name="paymentMethodId" isCod="${paymentMethod.iscod}"  value="${paymentMethod.paymentMethodId}" onchange="changePaymentMethod(this,'${regionId}');" onclick="this.blur();this.focus();"  validConf="required"/>
										${paymentMethod.paymentMethodName}
									</label>
								</c:forEach>
								<c:if test="${empty paymentMethodList}">
									<b><font color="red"><fmt:message key="checkout.noPaymentMethod"/></font></b>
									<input type="hidden" name="paymentMethodId" validConf="required"/>
								</c:if>
							</td>	
						</tr>
						<tr group="selfCollect" style="display:none;">
							<th><fmt:message key="salesOrder.selfCollectionCentreName"/>:</th>
							<td><div class="warning_msg" id="selfCollectionCentreList" >loading...</div></td>
						</tr>
						<tr group="selfCollect" style="display:none;">
							<th>
								<fmt:message key="salesOrder.exceptedSelfCollectDate"/>:
							</th>
							<td>
								<select id="exceptedSelfCollectDate" name="exceptedSelfCollectDate">
									<c:forEach var="selfCollectDate" items="${selfCollectDateList}" varStatus="status">
										<option value="<fmt:formatDate value="${selfCollectDate}" pattern="yyyy-MM-dd"/>">
											<fmt:formatDate value="${selfCollectDate}" dateStyle="full"/>
										</option>
									</c:forEach>
								</select>
							</td>
						</tr>
						<tr group="shippingMethod" >
							<th><fmt:message key="checkout.paymentMethod.shippingMethodName"/>:</th>
							<td><div class="warning_msg" id="shippingMethodList">loading....</div></td>
						</tr>
						<tr group="specifiedDeliveryTime shippingMethod" >
							<th><fmt:message key="checkout.paymentMethod.deliveryTime"/>:</th>
							<td>
								<c:forEach begin="0" end="2" varStatus="varStatus">
									<input type="radio" name="specifiedDeliveryTime" id="dt_${varStatus.index+1}"  value="<fmt:message key="checkout.paymentMethod.deliveryTime.value${varStatus.index+1}"/>" <c:if test="${varStatus.first}">checked="true"</c:if> />
									<label for="dt_${varStatus.index+1}"><fmt:message key="checkout.paymentMethod.deliveryTime.label${varStatus.index+1}"/></label>
								</c:forEach>
								
							</td>
						</tr>
						<tr group="specifiedDeliveryTime shippingMethod">
							<th><fmt:message key="checkout.paymentMethod.needConfirmB4Delivery"/>:</th>
							<td>
								<input type='radio' name="needConfirmB4Delivery" id="ncbd_1" value="1" />
								<label for="ncbd_1"><fmt:message key="common.message.yes"/></label>
								<input type='radio' name="needConfirmB4Delivery" id="ncbd_0" value="0" checked="true" />
								<label for="ncbd_0"><fmt:message key="common.message.no"/></label>
							</td>
						</tr>
						<tr id="paymentTypePanel" group="cod" style="display:none;">
							<th><fmt:message key="checkout.paymentMethod.paymentType"/>:</th>
							<td>
								<c:forEach begin="0" end="2" varStatus="varStatus">
									<input type='radio' name="paymentType" id='pt_${varStatus.index+1}' value="${varStatus.index+1}"  <c:if test="${varStatus.first}">checked="true"</c:if> />
									<label for="pt_${varStatus.index+1}"><fmt:message key="checkout.paymentMethod.paymentType.label${varStatus.index+1}"/></label>
								</c:forEach>
							</td>
						</tr>
					</table>
				</c:when>
				<c:otherwise>
					<table width="100%" border="0" cellspacing="0" cellpadding="0" class="settings_table1"  height="60px;">
						<tr>
							<td>
								<div class="warning_msg"><span class="red"><fmt:message key="salesOrder.addPanel.payAndShipMethod.regionRequired"/></span></div>
							</td>
						</tr>
					</table>		
				</c:otherwise>
			</c:choose>
			
		</div>
	</div>
</div>

<br/>
<br/>

<script type="text/javascript">
$j(document).ready(function () {
	<c:if test="${not empty regionId and not empty paymentMethodList}">
		//送货时间隐藏
		$j("[group*='specifiedDeliveryTime']").hide();
		//选择第一个支付方式
		$j('input[name="paymentMethodId"]:first').attr("checked",true).change();
	</c:if>
	
});
</script>
